package com.example.demo1101.demo1;

public class TestJoin {
    public static void main(String[] args) throws InterruptedException {
        JoinDemo joinDemo = new JoinDemo();
        joinDemo.start();

        JoinDemo joinDemo1 = new JoinDemo();
        joinDemo1.start();

        joinDemo1.join();
        joinDemo.join();


        for (int i = 0; i < 20; i++) {
            System.out.println("main========= " + i);
        }
    }
}

class JoinDemo extends Thread {
    @Override
    public void run() {
        for (int i = 0; i < 20; i++) {
            System.out.println(Thread.currentThread().getName() + "+++++++" + i);
        }

    }
}